package com.itheima.stream流;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        ArrayList<String>list=new ArrayList<>();
        list.add("张忌");
        list.add("张学友");
        list.add("赵本");
        //条件：包含张并且长度为2
     list.stream().filter(s->s.startsWith("张"))
             .filter(s->s.length()==2)
             .forEach(s-> System.out.println(s));


        ArrayList<String>list2=new ArrayList<>();
        list2.stream().filter(s->s.startsWith("本"))
                .filter(s->s.length()==2)
                .forEach(s-> System.out.println("列表二条件结果："+s));

    }
}
